import {
  createRouter,
  createWebHistory,
  RouteRecordRaw
} from "vue-router";

// 首页
const main: RouteRecordRaw = {
  path: "/",
  component: () => import("@/container/Main/index.vue"),
  meta: {
    title: "首页"
  }
}

// 表单
const form: RouteRecordRaw = {
  path: "/form/:id",
  component: () => import("@/container/Form/index.vue"),
  meta: {
    title: "表单"
  },
  children: []
}

// demo
const demo: RouteRecordRaw = {
  path: "/demo",
  component: () => import("@/container/Demo/index.vue"),
}

// 404
const notFound: RouteRecordRaw = {
  path: "/:pathMatch(.*)*",
  component: () => import("@/container/Notfound/index.vue"),
}

const routes = [
  main,
  form,
  demo,
  notFound
]

const router = createRouter({
  history: createWebHistory(),
  routes,
})

export default router